// ，路由模块抽离：需要注意路径问题。以下为标准写法
// 注意：是从当前路径下的/home找文件  当前路径即src
import VueRouter from 'vue-router'
// import home from './home/indexforhome.vue'
// import loginregister from './login/loginregister.vue'
// import goodDetials from './gooddetail/gooddetails.vue'
// import products from './home/products.vue'
// import usercenter from './home/usercenter.vue'
// import customerservice from './home/customerservice.vue'
// import applications from './home/applications.vue'

const home = () => import('./home/indexforhome.vue')
const loginregister = () => import('./login/loginregister.vue')
const goodDetials = () => import('./gooddetail/gooddetails.vue')
const products = () => import('./home/products.vue')
const usercenter = () => import('./home/usercenter.vue')
const customerservice = () => import('./home/customerservice.vue')
const applications = () => import('./home/applications.vue')


var router = new VueRouter({
    // base: '/history',
    mode: 'history',  // 默认模式  hash 
    routes: [

        {
            path: '',
            redirect: { name: 'home' },
            meta: { keepAlive: false }
        },
        {
            path: '/home',
            component: home,
            name: 'home',
            meta: { keepAlive: false }
        },
        {
            path: '/loginregister',
            component: loginregister,
            name: 'loginregister',
            meta: { keepAlive: false }
        },
        {
            path: '/details',
            component: goodDetials,
            name: 'details',
            meta: { keepAlive: false }
        },
        {
            path: '/products',
            component: products,
            name: 'products',
            meta: { keepAlive: true }
        },
        {
            path: '/usercenter',
            component: usercenter,
            name: 'usercenter',
            meta: { keepAlive: false }
        },
        {
            path: '/customerservice',
            component: customerservice,
            name: 'customerservice',
            meta: { keepAlive: false }
        },
        {
            path: '/applications',
            component: applications,
            name: 'applications',
            meta: { keepAlive: true }
        }

    ]
})

export default router
